package webcrawlerThreading;

public class PageParser {
	private String my_string;
	
	public void Tokenizer(Object the_object) {
		//my_string = the_string.trim();
	}
	
	private class Iterator implements java.util.Iterator<String> {
		private int string_index;

		public boolean hasNext() {
			return string_index < my_string.length();
		}
		
		public String next() {
			StringBuilder temp = new StringBuilder();
			
			if (!hasNext()) 
				System.out.println("There is no string to tokenize.");

			if (my_string.charAt(string_index) == '<') {
				int string_index_temp = string_index;
				while ((string_index_temp - string_index) < 4 ) {
					temp.append(my_string.charAt(string_index_temp));
					string_index_temp++;
				}
				if (temp.toString().equals("</http>")) {
					string_index = string_index_temp;
					return temp.toString();
				}
			}
		}
		public void remove() {
			// Does Nothing
		}
	}
	@Override
	public java.util.Iterator<String> iterator() {
		return new Iterator();
	}
}
